/**
 * kaGridListHeaderMenu 封装 列表头菜单按钮
 * 
 * 版本：v1.0
 * 
 * Stanley
 **/
layui.define(['jquery'],
    function (exports) {
        var $ = layui.jquery;
        var kaGridColsTempletLoadJs = new function () {
            this.init = function (jsUrl, tableThis) {
                var ps = top[jsUrl + "_ButtonFunData"];
                if(ps == undefined || ps == null){
                    $.ajax({
                        url: "../kaGrid/cols/buttonfun/" + jsUrl + ".js",
                        type: "GET",
                        dataType: "script",
                        async: false, //同步
                        success: function () {
                            var pageEventsData = eval(jsUrl + "_ButtonFunData");
                            if (pageEventsData != undefined) {
                                if (typeof pageEventsData.initStart === 'function') {
                                    top[jsUrl + "_ButtonFunData"] = pageEventsData;
                                    pageEventsData.initStart(tableThis);
                                } 
                            }
                        },
                        timeout: 5000 // 5秒超时
                    });
                } else {
                     if (typeof ps.initStart === 'function') {
                        ps.initStart(tableThis);
                    } 
                }
            }
        };
        exports('kaGridColsTempletLoadJs', kaGridColsTempletLoadJs);
    }
)